package com.mvp.shq.washer.ui.home;

import com.mvp.shq.washer.entity.Banner;
import com.mvp.shq.washer.entity.BaseResult;
import com.mvp.shq.washer.http.BaseObserver;
import com.mvp.shq.washer.utils.SpUtil;

import java.util.List;

/**
 * Created by Administrator on 2017/8/19.
 */

public class HomePresenter extends HomeConstract.Presenter {
    @Override
    public void onStart() {

    }

    @Override
    public void banner() {
        model.banner().subscribe(new BaseObserver<List<Banner>>(view) {
            @Override
            protected void onSuccees(BaseResult<List<Banner>> t) throws Exception {
                if (!t.isError()){
                    view.getBannerSuccess(t.getData());
                }else {
                    view.getBannerFail(t.getMsg());
                }
            }

            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                view.getBannerFail("未知错误");
            }
        });
    }
}
